{# A before and an after. The change is worked out here, never carried in the payload: a figure the assistant could derive is one the assistant could get wrong. Both bars scale to the larger; a rise is teal, a fall the error tone, and a figure appearing from zero is new, not an infinite rise. #} {% from "partials/chat/cards/_frame.html" import card_frame, amount %} {% set before = card["before"] %} {% set after = card["after"] %} {% set peak = [before, after]|max %} {% set fresh = before == 0 and after > 0 %} {% set up = fresh or after >= before %} {% set pct = ((after - before) / before * 100)|round(1) if before else None %} {% call card_frame("compare", card["title"], card["measure"], card_url, large) %}
{% if fresh %}new{% elif pct is none %}no baseline{% else %}{{ "+" if pct >= 0 else "" }}{{ pct }}%{% endif %}